#if defined mythreads_inc
 #endscript
#endif
#define mythreads_inc

#pragma library "mythreads"


/** Create thread which calls specific function while function returns non-zero
 * func[] - function name to call
 * timeout - time beetween function calls
 * extra - a param which will be passed to the function, if it will not be -1
 * Returns: threadid
 **/
native thread_create(const func[], timeout, extra = -1);

/** Terminate specific thread by threadid
 * threadid - id of thread which will be terminated
 * Returns: 1 if success
 **/
native thread_terminate(threadid);

/** Wait for specific thread end
 * threadid:
 * * id of thread which will be waited for 
 * * -1 to wait for each owned thread
 * * -2 to wait for every thread
 * Returns: 1 if success
 **/
native thread_join(threadid);

/** Check if specific thread id valid
 * threadid - id of thread
 * Returns: 1 if valid
 **/
native thread_isvalid(threadid);

/** Check if specific thread id created in this AMX file
 * threadid - id of thread
 * Returns: 1 if thread is created in this file
 **/
native thread_isowned(threadid);

/** Sleep for specific time
 * milisecs - time in miliseconds
 * Returns: 1 if milisecs > 0
 **/
native thread_sleep(milisecs);

/** Give to processor a quant of time to execute other threads
 * Returns: 1
 **/
native thread_yield();
